package lab6.systemCustom;

import java.util.ArrayList;

@SuppressWarnings("unchecked")
public class ListAllCoursesHandler extends CommandEventHandler {

	public ListAllCoursesHandler(DataBase objDataBase, int iCommandEvCode, int iOutputEvCode) {
		super(objDataBase, iCommandEvCode, iOutputEvCode);
	}

	protected String execute(String param) {
		ArrayList vCourse = this.objDataBase.getAllCourseRecords();

		String sReturn = "";
		for (int i = 0; i < vCourse.size(); i++) {
			sReturn += (i == 0 ? "" : "\n") + ((Course) vCourse.get(i)).toString();
		}
		return sReturn;
	}

}